#include <stdio.h>
#include <stdlib.h>
int line_find(int* data,int count,int num){
	int i = 0;
	for(i = 0;i < count;i++){
		if(num == data[i]){
			return i + 1;	
		}
	}
	return -1;
}
int half_find(int* data,int count, int num){
	int left = 0;
	int right = count - 1;
	int con = count / 2;	
	while(left <= right){
		int con = (left + right) / 2;
		if(num < data[con]){
			right = con - 1;
		}else if(num > data[con]){
			left = con + 1;
			}else{
			return con + 1;
				}
		}
	return -1;
	}
int main (){
	int data[] = {90,0,70,20,30,80,10,40,60,50};
	int pos = line_find(data,sizeof(data)/sizeof(data[0]),80);
	if(pos != -1) printf("i = %d \n",pos);
	int data1[] = {10,20,30,40,50,60,70,80};
	int pos1 = half_find(data1,sizeof(data1)/sizeof(data1[0]),60);
	printf("i = %d \n",pos1);
	}
